package top.cardone.api.v1.usercenter.department

import top.cardone.context.ApplicationContextHolder
import top.cardone.usercenter.service.DepartmentService

class modifyModal implements java.io.Serializable {
    def input(input) {
        ["departmentId": input.departmentId]
    }

    def validation(input) {
//      if (StringUtils.isBlank(input?.departmentId)) {
//          throw new CodeException("departmentId required", "部门标识必填")
//      }
    }

    def func(input) {
        ApplicationContextHolder.getBean(DepartmentService.class).findOne(input)
    }

    def output(output) {
        def newOutput = [:]

        newOutput['departmentCode'] = output['DEPARTMENT_CODE']
        newOutput['name'] = output['NAME']
        newOutput['parentCode'] = output['PARENT_CODE']
        newOutput['parentTreeName'] = output['PARENT_TREE_NAME']

        newOutput
    }
}